//
//  L0PlugSuitNotNullTransformer.m
//  PlugSuit
//
//  Created by ∞ on 19/10/07.
//  Copyright 2007 __MyCompanyName__. All rights reserved.
//

#import "L0PlugSuitNotNullTransformer.h"

static BOOL _registered = NO;

@implementation L0PlugSuitNotNullTransformer

+ (Class) transformedValueClass { return [NSNumber class]; }

+ (BOOL) allowsReverseTransformation { return NO; }

+ (void) registerClass {
	if (!_registered) {
		_registered = YES;
		[NSValueTransformer setValueTransformer:[[self new] autorelease] forName:NSStringFromClass(self)];
	}
}

- (id) transformedValue:(id) value {
    return ([value isKindOfClass:[NSArray class]] && [value count] != 0)?
		[NSNumber numberWithBool:YES] : [NSNumber numberWithBool:NO];
}

@end